package com.hs.sfzy.controller;

import com.github.pagehelper.PageInfo;
import com.hs.sfzy.entity.PubCenter;
import com.hs.sfzy.service.PubCenterService;
import com.hs.sfzy.until.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @ClassName PubCenterController
 * @Description TODO
 * @Author liuzhuo
 * @Date 2025年08月13日 15:01
 * @Version 1.0
 */
@RestController
@RequestMapping("PubCenter")
public class PubCenterController {
    @Autowired
    private PubCenterService pubCenterService;

    @GetMapping
    public R getPubCenter(PubCenter pubCenter,@RequestParam(required = false,defaultValue = "1") int pageNum,
                          @RequestParam(required = false,defaultValue = "3") int pageSize) {
        PageInfo<PubCenter> pubCenterPageInfo = pubCenterService.selectAll(pubCenter ,pageNum,pageSize);
        return R.ok(pubCenterPageInfo);
    }
    @GetMapping("{id}")
    public R getPubCenter(@PathVariable("id") int id) {
        PubCenter pubCenter = pubCenterService.selectById(id);
        return R.ok(pubCenter);
    }
}

